<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8" />
  <title>index1</title>
  <!-- 引入Vue -->
  <script type="text/javascript" src="../../js/vue.js"></script>
</head>

<body>
  <!-- 准备好一个容器-->
  <div id="demo">
    <h2>{{fullName}}</h2>
    姓：<input type="text" v-model="firstName">

    名：<input type="text" v-model="lastName">
  </div>
</body>
<!-- 使用插值语法 -->
<script type="text/javascript">
  // 创建实例
  var vm = new Vue({
    el: '#demo',
    data() {
      return {
        firstName: '',
        lastName: ''
      }
    },
    computed: {
      fullName() {
        return this.firstName + ' ' + this.lastName;
      }
    },
  })
</script>

</html>